import urllib.request

# 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
# https UA校验反爬，需封装request headers
url = 'https://www.baidu.com/s?wd=%E8%92%9C%E6%B3%A5%E7%99%BD%E8%82%89'

headers = {
    'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}

request = urllib.request.Request(url=url, headers=headers)

response = urllib.request.urlopen(request)

content = response.read().decode('utf-8')

print(content)
